package it.aekidna.cleverplatypus.mediator.tools
{
	import it.aekidna.cleverplatypus.mediator.MediationInfo;
	
	import mx.collections.ArrayCollection;
	
	[Bindable]
	public class MediationRegistryToolMediationDescriptor
	{
		public var info : MediationInfo;
		public var lastCall : Date = new Date();
		public var calls : ArrayCollection = new ArrayCollection();
		public var listeners : ArrayCollection = new ArrayCollection();
		
		public function MediationRegistryToolMediationDescriptor( inInfo : MediationInfo )
		{
			info = inInfo;
		}
		
		public function get eventName() : String
		{
			return info.eventName;
		}
		
		public function set eventName( inValue : String ) : void
		{
			// empty setter to avoid binding warnings
		}
		
		public function onCall( inParams : Array ) : void
		{
			lastCall = new Date();
			var theCall : MediationCall = new MediationCall();
			theCall.time = lastCall;
			theCall.params = inParams;
			theCall.listenerClass = info.listenerObjectClass;
			calls.addItemAt( theCall , 0 );
		}
	}
}
[Bindable]
class MediationCall {
	public var listenerClass : String;
	public var time : Date = new Date();
	public var params : Array;
}